package cate.game.play.buff.h;

import cate.common.table.d.GDPlay;
import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.ActionCtx;

/**
 * 抵挡一次分摊伤害
 */
public class 免疫分摊伤害BH extends BuffHandler {

	private int 次数;

	//次数=1
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		次数 = args.getInt("次数", 0);
	}

	private int num;

	@Override
	public boolean hurtImmune(ActionCtx action, int reason) {
		if (reason != GDPlay.HpReason.SHARE_HURT) {
			return false;
		}
		num++;
		if (num >= 次数) {
			buff.markInvalid(action);
		}
		return true;
	}
}
